<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>设置我的资料</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/layuiadmin/style/admin.css" media="all">
    <style type="text/css">
        .readOnly{
            color:rgba(0, 0, 0,0.4);
        }
    </style>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">设置我的资料</div>
                <div class="layui-card-body" pad15>

                    <form class="layui-form" lay-filter="">
                        <div class="layui-form-item">
                            <label class="layui-form-label">我的角色</label>
                            <div class="layui-input-inline">
                                <select name="adm_role_id" lay-verify="" disabled>
                                    <option selected>{$roleInfo['rol_name']}</option>
                                </select>
                            </div>
                        </div>
                        {if $isInstitutionAdmin}
                        <div class="layui-form-item">
                            <label class="layui-form-label">我的机构</label>
                            <div class="layui-input-inline">
                                <input type="text"  value="{$isInstitutionAdmin['ins_name']}" readonly class="layui-input readOnly">
                            </div>
                        </div>
                        {/if}
                        <div class="layui-form-item">
                            <label class="layui-form-label">用户名</label>
                            <div class="layui-input-inline">
                                <input type="text" name="adm_username" value="{$adminInfo['adm_username']}" readonly class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">不可修改。一般用于后台登入名</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">姓名</label>
                            <div class="layui-input-inline">
                                <input type="text" name="adm_realname" value="{$adminInfo['adm_realname']}" lay-verify="nickname" autocomplete="off" placeholder="请输入昵称" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">手机</label>
                            <div class="layui-input-inline">
                                <input type="text" name="adm_mobile" value="{$adminInfo['adm_mobile']}" lay-verify="phone" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">邮箱</label>
                            <div class="layui-input-inline">
                                <input type="text" name="adm_email" value="{$adminInfo['adm_email']}" lay-verify="email" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="setmyinfo" id="confirm">确认修改</button>
                                <button id="reset" class="layui-btn layui-btn-primary">重新填写</button>
                            </div>
                        </div>
                    </form>

                </div>
            </div>
        </div>
    </div>
</div>

<script src="/static/layuiadmin/layui/layui.js"></script>
<script src="/static/layuiadmin/lib/jquery.min.js"></script>
<script>
    layui.config({
        base: '/static/layuiadmin/' //静态资源所在路径
    });
    layui.use(['form', 'layedit'], function(){
        var form = layui.form
            , layer = layui.layer
            , $ = layui.jquery;
        form.on('submit(setmyinfo)', function (data) {
            $.ajax({
                type: 'POST',
                url: "{:url ('admin/admin/baseInfo')}",
                dataType: 'json',
                data: data.field,//往后台发送的是data.field，即一个{name：value}的数据结构
                async: true,
                success: function (res) {
                    if (res.code == 1) {
                        layer.msg('数据更新成功！', {icon: 1, time: 1500}, function () {
                            window.location.reload();
                        });
                    } else {
                        layer.msg(res.msg, {icon: 5, time: 1500}, function () {
                            window.location.reload();
                        });
                    }
                }

            });
            return false;
        });
        return false;
    });
    $("#reset").click(function(){
        layer.confirm("数据将不会被保存！",{icon:3,title:"重新填写"},function(index){
            layer.close(index); //关闭询问框
            //下面写具体的逻辑代码
            window.location.reload();
        })
        return false;
    });
</script>
</body>
</html>
